package com.kid.keep.dao.recommendation;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kid.keep.bo.ReportRecommendationBO;
import com.kid.keep.po.Recommendation;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description Recommendation dao
 * @Author JOHN
 * @Create 2019-01-10
 * @Since 1.0.0
 */
@Repository
public class RecommendationRepository extends ServiceImpl<IRecommendationMapper, Recommendation> implements IRecommendationRepository {


    @Override
    public List<Recommendation> findAllByItemIdInAndDataStatus(List<Long> itemIds, Integer dataStatus) {
        return this.baseMapper.selectList(new QueryWrapper<Recommendation>().lambda().in(Recommendation::getItemId, itemIds).eq(Recommendation::getDataStatus, dataStatus));
    }

    @Override
    public List<ReportRecommendationBO> findByReportId(Long reportId) {
        return this.baseMapper.findByReportId(reportId);
    }
}


